package com.itheima;

import java.util.ArrayList;
import java.util.Collection;

public class ArrayListDemo {
    public static void main(String[] args) {
        ArrayList<String> alt = new ArrayList<String>();
        Collection<String> clt = new ArrayList<>();
        System.out.println("ArrayList : " + alt);
        alt.add("hello");
        alt.add("world");
        alt.add("java");
        System.out.println("ArrayList : " + alt);
        System.out.println(alt.get(2));   //通过get()方法，利用index进行访问
        alt.add(1,"java se");
        System.out.println("ArrayList : " + alt);
//        alt.add(5,"java ee");    //会报错，ArrayList索引越界


    }
}
